package com.itheima.lambda.test1;

public class TestSwimming {
    public static void main(String[] args) {
        //1. 调用goSwimming方法,传入一个匿名内部类充当实际参数

        /*
            理解: 对于Lambda表达式, 对匿名内部类进行了优化
         */
        goSwimming(() -> System.out.println("铁汁, 我们去游泳吧"));
    }
    /**
     * 使用接口的方法
     */
    public static void goSwimming(Swimming swimming) {
        /*
            Swimming swimming = new Swimming() {
                @Override
                public void swim() {
                    System.out.println("铁汁, 我们去游泳吧");
                }
            }
         */
        swimming.swim();
    }
}

/*
    游泳接口
 */
interface Swimming {
    void swim();
}
